/**
 *
 */
import Util;
import OSS;
import OpenPlatform;
import OSSUtil;
import FileForm;
import OpenApi;
import OpenApiUtil;
import EndpointUtil;

extends OpenApi;


init(config: OpenApi.Config){
  super(config);
  @endpointRule = 'regional';
  @endpointMap = {
    'ap-northeast-1' = 'docmind-api.aliyuncs.com',
    'ap-northeast-2-pop' = 'docmind-api.aliyuncs.com',
    'ap-south-1' = 'docmind-api.aliyuncs.com',
    'ap-southeast-1' = 'docmind-api.aliyuncs.com',
    'ap-southeast-2' = 'docmind-api.aliyuncs.com',
    'ap-southeast-3' = 'docmind-api.aliyuncs.com',
    'ap-southeast-5' = 'docmind-api.aliyuncs.com',
    'cn-beijing' = 'docmind-api.aliyuncs.com',
    'cn-beijing-finance-1' = 'docmind-api.aliyuncs.com',
    'cn-beijing-finance-pop' = 'docmind-api.aliyuncs.com',
    'cn-beijing-gov-1' = 'docmind-api.aliyuncs.com',
    'cn-beijing-nu16-b01' = 'docmind-api.aliyuncs.com',
    'cn-chengdu' = 'docmind-api.aliyuncs.com',
    'cn-edge-1' = 'docmind-api.aliyuncs.com',
    'cn-fujian' = 'docmind-api.aliyuncs.com',
    'cn-haidian-cm12-c01' = 'docmind-api.aliyuncs.com',
    'cn-hangzhou-bj-b01' = 'docmind-api.aliyuncs.com',
    'cn-hangzhou-finance' = 'docmind-api.aliyuncs.com',
    'cn-hangzhou-internal-prod-1' = 'docmind-api.aliyuncs.com',
    'cn-hangzhou-internal-test-1' = 'docmind-api.aliyuncs.com',
    'cn-hangzhou-internal-test-2' = 'docmind-api.aliyuncs.com',
    'cn-hangzhou-internal-test-3' = 'docmind-api.aliyuncs.com',
    'cn-hangzhou-test-306' = 'docmind-api.aliyuncs.com',
    'cn-hongkong' = 'docmind-api.aliyuncs.com',
    'cn-hongkong-finance-pop' = 'docmind-api.aliyuncs.com',
    'cn-huhehaote' = 'docmind-api.aliyuncs.com',
    'cn-huhehaote-nebula-1' = 'docmind-api.aliyuncs.com',
    'cn-north-2-gov-1' = 'docmind-api.aliyuncs.com',
    'cn-qingdao' = 'docmind-api.aliyuncs.com',
    'cn-qingdao-nebula' = 'docmind-api.aliyuncs.com',
    'cn-shanghai' = 'docmind-api.aliyuncs.com',
    'cn-shanghai-et15-b01' = 'docmind-api.aliyuncs.com',
    'cn-shanghai-et2-b01' = 'docmind-api.aliyuncs.com',
    'cn-shanghai-finance-1' = 'docmind-api.aliyuncs.com',
    'cn-shanghai-inner' = 'docmind-api.aliyuncs.com',
    'cn-shanghai-internal-test-1' = 'docmind-api.aliyuncs.com',
    'cn-shenzhen' = 'docmind-api.aliyuncs.com',
    'cn-shenzhen-finance-1' = 'docmind-api.aliyuncs.com',
    'cn-shenzhen-inner' = 'docmind-api.aliyuncs.com',
    'cn-shenzhen-st4-d01' = 'docmind-api.aliyuncs.com',
    'cn-shenzhen-su18-b01' = 'docmind-api.aliyuncs.com',
    'cn-wuhan' = 'docmind-api.aliyuncs.com',
    'cn-wulanchabu' = 'docmind-api.aliyuncs.com',
    'cn-yushanfang' = 'docmind-api.aliyuncs.com',
    'cn-zhangbei' = 'docmind-api.aliyuncs.com',
    'cn-zhangbei-na61-b01' = 'docmind-api.aliyuncs.com',
    'cn-zhangjiakou' = 'docmind-api.aliyuncs.com',
    'cn-zhangjiakou-na62-a01' = 'docmind-api.aliyuncs.com',
    'cn-zhengzhou-nebula-1' = 'docmind-api.aliyuncs.com',
    'eu-central-1' = 'docmind-api.aliyuncs.com',
    'eu-west-1' = 'docmind-api.aliyuncs.com',
    'eu-west-1-oxs' = 'docmind-api.aliyuncs.com',
    'me-east-1' = 'docmind-api.aliyuncs.com',
    'rus-west-1-pop' = 'docmind-api.aliyuncs.com',
    'us-east-1' = 'docmind-api.aliyuncs.com',
    'us-west-1' = 'docmind-api.aliyuncs.com',
  };

  checkConfig(config);
  @endpoint = getEndpoint('docmind-api', @regionId, @endpointRule, @network, @suffix, @endpointMap, @endpoint);
}

function getEndpoint(productId: string, regionId: string, endpointRule: string, network: string, suffix: string, endpointMap: map[string]string, endpoint: string) throws: string{
  if (!Util.empty(endpoint)) {
    return endpoint;
  }
  
  if (!Util.isUnset(endpointMap) && !Util.empty(endpointMap[regionId])) {
    return endpointMap[regionId];
  }
  return EndpointUtil.getEndpointRules(productId, regionId, endpointRule, network, suffix);
}

model AyncTradeDocumentPackageExtractSmartAppRequest {
  customExtractionRange?: [ string ](name='CustomExtractionRange'),
  fileName?: string(name='FileName'),
  fileUrl?: string(name='FileUrl', description='This parameter is required.'),
  option?: string(name='Option'),
  templateName?: string(name='TemplateName'),
}

model AyncTradeDocumentPackageExtractSmartAppShrinkRequest {
  customExtractionRangeShrink?: string(name='CustomExtractionRange'),
  fileName?: string(name='FileName'),
  fileUrl?: string(name='FileUrl', description='This parameter is required.'),
  option?: string(name='Option'),
  templateName?: string(name='TemplateName'),
}

model AyncTradeDocumentPackageExtractSmartAppResponseBody = {
  completed?: boolean(name='Completed'),
  createTime?: string(name='CreateTime'),
  data?: any(name='Data'),
  requestId?: string(name='RequestId', example='43A29C77-405E-4CC0-BC55-EE694AD00655'),
  status?: string(name='Status'),
  success?: boolean(name='Success'),
}

model AyncTradeDocumentPackageExtractSmartAppResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: AyncTradeDocumentPackageExtractSmartAppResponseBody(name='body'),
}

/**
 * @summary 整票识别
 *
 * @param tmpReq AyncTradeDocumentPackageExtractSmartAppRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return AyncTradeDocumentPackageExtractSmartAppResponse
 */
async function ayncTradeDocumentPackageExtractSmartAppWithOptions(tmpReq: AyncTradeDocumentPackageExtractSmartAppRequest, runtime: Util.RuntimeOptions): AyncTradeDocumentPackageExtractSmartAppResponse {
  Util.validateModel(tmpReq);
  var request = new AyncTradeDocumentPackageExtractSmartAppShrinkRequest{};
  OpenApiUtil.convert(tmpReq, request);
  if (!Util.isUnset(tmpReq.customExtractionRange)) {
    request.customExtractionRangeShrink = OpenApiUtil.arrayToStringWithSpecifiedStyle(tmpReq.customExtractionRange, 'CustomExtractionRange', 'json');
  }
  var query = {};
  if (!Util.isUnset(request.customExtractionRangeShrink)) {
    query['CustomExtractionRange'] = request.customExtractionRangeShrink;
  }
  if (!Util.isUnset(request.fileName)) {
    query['FileName'] = request.fileName;
  }
  if (!Util.isUnset(request.fileUrl)) {
    query['FileUrl'] = request.fileUrl;
  }
  if (!Util.isUnset(request.option)) {
    query['Option'] = request.option;
  }
  if (!Util.isUnset(request.templateName)) {
    query['TemplateName'] = request.templateName;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'AyncTradeDocumentPackageExtractSmartApp',
    version = '2022-07-11',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary 整票识别
 *
 * @param request AyncTradeDocumentPackageExtractSmartAppRequest
 * @return AyncTradeDocumentPackageExtractSmartAppResponse
 */
async function ayncTradeDocumentPackageExtractSmartApp(request: AyncTradeDocumentPackageExtractSmartAppRequest): AyncTradeDocumentPackageExtractSmartAppResponse {
  var runtime = new Util.RuntimeOptions{};
  return ayncTradeDocumentPackageExtractSmartAppWithOptions(request, runtime);
}

model GetDocParserResultRequest {
  id?: string(name='Id', example='docmind-20220816-1e89d65c'),
  layoutNum?: int32(name='LayoutNum'),
  layoutStepSize?: int32(name='LayoutStepSize'),
}

model GetDocParserResultResponseBody = {
  code?: string(name='Code'),
  data?: map[string]any(name='Data'),
  message?: string(name='Message'),
  requestId?: string(name='RequestId'),
}

model GetDocParserResultResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: GetDocParserResultResponseBody(name='body'),
}

/**
 * @summary 文档结构化流式接口
 *
 * @param request GetDocParserResultRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return GetDocParserResultResponse
 */
async function getDocParserResultWithOptions(request: GetDocParserResultRequest, runtime: Util.RuntimeOptions): GetDocParserResultResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.id)) {
    query['Id'] = request.id;
  }
  if (!Util.isUnset(request.layoutNum)) {
    query['LayoutNum'] = request.layoutNum;
  }
  if (!Util.isUnset(request.layoutStepSize)) {
    query['LayoutStepSize'] = request.layoutStepSize;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'GetDocParserResult',
    version = '2022-07-11',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary 文档结构化流式接口
 *
 * @param request GetDocParserResultRequest
 * @return GetDocParserResultResponse
 */
async function getDocParserResult(request: GetDocParserResultRequest): GetDocParserResultResponse {
  var runtime = new Util.RuntimeOptions{};
  return getDocParserResultWithOptions(request, runtime);
}

model GetDocStructureResultRequest {
  id?: string(name='Id', example='docmind-20220816-1e89d65c'),
  imageStrategy?: string(name='ImageStrategy'),
  revealMarkdown?: boolean(name='RevealMarkdown'),
  useUrlResponseBody?: boolean(name='UseUrlResponseBody'),
}

model GetDocStructureResultResponseBody = {
  code?: string(name='Code', example='noPermission'),
  completed?: boolean(name='Completed'),
  data?: map[string]any(name='Data'),
  message?: string(name='Message', example='You are not authorized to perform this operation.'),
  requestId?: string(name='RequestId', example='43A29C77-405E-4CC0-BC55-EE694AD00655'),
  status?: string(name='Status', example='Success'),
}

model GetDocStructureResultResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: GetDocStructureResultResponseBody(name='body'),
}

/**
 * @summary 文档智能解析结果查询
 *
 * @param request GetDocStructureResultRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return GetDocStructureResultResponse
 */
async function getDocStructureResultWithOptions(request: GetDocStructureResultRequest, runtime: Util.RuntimeOptions): GetDocStructureResultResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.id)) {
    query['Id'] = request.id;
  }
  if (!Util.isUnset(request.imageStrategy)) {
    query['ImageStrategy'] = request.imageStrategy;
  }
  if (!Util.isUnset(request.revealMarkdown)) {
    query['RevealMarkdown'] = request.revealMarkdown;
  }
  if (!Util.isUnset(request.useUrlResponseBody)) {
    query['UseUrlResponseBody'] = request.useUrlResponseBody;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'GetDocStructureResult',
    version = '2022-07-11',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary 文档智能解析结果查询
 *
 * @param request GetDocStructureResultRequest
 * @return GetDocStructureResultResponse
 */
async function getDocStructureResult(request: GetDocStructureResultRequest): GetDocStructureResultResponse {
  var runtime = new Util.RuntimeOptions{};
  return getDocStructureResultWithOptions(request, runtime);
}

model GetDocumentCompareResultRequest {
  id?: string(name='Id'),
}

model GetDocumentCompareResultResponseBody = {
  code?: string(name='Code', example='noPermission'),
  completed?: boolean(name='Completed'),
  data?: any(name='Data'),
  message?: string(name='Message', example='You are not authorized to perform this operation.'),
  requestId?: string(name='RequestId', example='43A29C77-405E-4CC0-BC55-EE694AD00655'),
  status?: string(name='Status', example='Success'),
}

model GetDocumentCompareResultResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: GetDocumentCompareResultResponseBody(name='body'),
}

/**
 * @summary 文档对比结果查询
 *
 * @param request GetDocumentCompareResultRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return GetDocumentCompareResultResponse
 */
async function getDocumentCompareResultWithOptions(request: GetDocumentCompareResultRequest, runtime: Util.RuntimeOptions): GetDocumentCompareResultResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.id)) {
    query['Id'] = request.id;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'GetDocumentCompareResult',
    version = '2022-07-11',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary 文档对比结果查询
 *
 * @param request GetDocumentCompareResultRequest
 * @return GetDocumentCompareResultResponse
 */
async function getDocumentCompareResult(request: GetDocumentCompareResultRequest): GetDocumentCompareResultResponse {
  var runtime = new Util.RuntimeOptions{};
  return getDocumentCompareResultWithOptions(request, runtime);
}

model GetDocumentConvertResultRequest {
  id?: string(name='Id', example='docmind-20220816-1e89d65c'),
}

model GetDocumentConvertResultResponseBody = {
  code?: string(name='Code', example='noPermission'),
  completed?: boolean(name='Completed', description='This parameter is required.'),
  data?: [ 
    {
      md5?: string(name='Md5', example='e6d83e55df218650b9a296bfbc300076'),
      size?: long(name='Size', example='2355965'),
      type?: string(name='Type', example='pdf'),
      url?: string(name='Url', example='http://docmind-api-cn-hangzhou.oss-cn-hangzhou.aliyuncs.com/convert/docmind-20220816-15bc7965/0.pdf?Expires=1660722412&OSSAccessKeyId=LTAI5tFEK2uEApeeYzxNMEci&Signature=f%2FKluINWMuuVyA5w22Z1wkoRjEg%3D'),
    }
  ](name='Data'),
  message?: string(name='Message', example='You are not authorized to perform this operation.'),
  requestId?: string(name='RequestId', example='43A29C77-405E-4CC0-BC55-EE694AD00655'),
  status?: string(name='Status', description='This parameter is required.', example='Success'),
}

model GetDocumentConvertResultResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: GetDocumentConvertResultResponseBody(name='body'),
}

/**
 * @summary 文档转换结果查询
 *
 * @param request GetDocumentConvertResultRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return GetDocumentConvertResultResponse
 */
async function getDocumentConvertResultWithOptions(request: GetDocumentConvertResultRequest, runtime: Util.RuntimeOptions): GetDocumentConvertResultResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.id)) {
    query['Id'] = request.id;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'GetDocumentConvertResult',
    version = '2022-07-11',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary 文档转换结果查询
 *
 * @param request GetDocumentConvertResultRequest
 * @return GetDocumentConvertResultResponse
 */
async function getDocumentConvertResult(request: GetDocumentConvertResultRequest): GetDocumentConvertResultResponse {
  var runtime = new Util.RuntimeOptions{};
  return getDocumentConvertResultWithOptions(request, runtime);
}

model GetDocumentExtractResultRequest {
  id?: string(name='Id', example='docmind-20220816-1e89d65c'),
}

model GetDocumentExtractResultResponseBody = {
  code?: string(name='Code', example='noPermission'),
  completed?: boolean(name='Completed'),
  data?: map[string]any(name='Data'),
  message?: string(name='Message', example='You are not authorized to perform this operation.'),
  requestId?: string(name='RequestId', example='43A29C77-405E-4CC0-BC55-EE694AD00655'),
  status?: string(name='Status', example='Success'),
}

model GetDocumentExtractResultResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: GetDocumentExtractResultResponseBody(name='body'),
}

/**
 * @summary 文档抽取结果查询
 *
 * @param request GetDocumentExtractResultRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return GetDocumentExtractResultResponse
 */
async function getDocumentExtractResultWithOptions(request: GetDocumentExtractResultRequest, runtime: Util.RuntimeOptions): GetDocumentExtractResultResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.id)) {
    query['Id'] = request.id;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'GetDocumentExtractResult',
    version = '2022-07-11',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary 文档抽取结果查询
 *
 * @param request GetDocumentExtractResultRequest
 * @return GetDocumentExtractResultResponse
 */
async function getDocumentExtractResult(request: GetDocumentExtractResultRequest): GetDocumentExtractResultResponse {
  var runtime = new Util.RuntimeOptions{};
  return getDocumentExtractResultWithOptions(request, runtime);
}

model GetPageNumRequest {
  bizId?: string(name='BizId'),
}

model GetPageNumResponseBody = {
  data?: {
    pageNum?: int32(name='PageNum'),
  }(name='Data'),
  errorCode?: string(name='ErrorCode'),
  errorMessage?: string(name='ErrorMessage'),
  httpCode?: string(name='HttpCode'),
  requestId?: string(name='RequestId'),
  success?: boolean(name='Success'),
}

model GetPageNumResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: GetPageNumResponseBody(name='body'),
}

/**
 * @summary openmind
 *
 * @param request GetPageNumRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return GetPageNumResponse
 */
async function getPageNumWithOptions(request: GetPageNumRequest, runtime: Util.RuntimeOptions): GetPageNumResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.bizId)) {
    query['BizId'] = request.bizId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'GetPageNum',
    version = '2022-07-11',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary openmind
 *
 * @param request GetPageNumRequest
 * @return GetPageNumResponse
 */
async function getPageNum(request: GetPageNumRequest): GetPageNumResponse {
  var runtime = new Util.RuntimeOptions{};
  return getPageNumWithOptions(request, runtime);
}

model GetTableUnderstandingResultRequest {
  id?: string(name='Id', example='docmind-20220816-1e89d65c'),
}

model GetTableUnderstandingResultResponseBody = {
  code?: string(name='Code', example='noPermission'),
  completed?: boolean(name='Completed'),
  data?: map[string]any(name='Data'),
  message?: string(name='Message', example='You are not authorized to perform this operation.'),
  requestId?: string(name='RequestId', example='43A29C77-405E-4CC0-BC55-EE694AD00655'),
  status?: string(name='Status', example='Success'),
}

model GetTableUnderstandingResultResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: GetTableUnderstandingResultResponseBody(name='body'),
}

/**
 * @summary 表格智能解析结果查询
 *
 * @param request GetTableUnderstandingResultRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return GetTableUnderstandingResultResponse
 */
async function getTableUnderstandingResultWithOptions(request: GetTableUnderstandingResultRequest, runtime: Util.RuntimeOptions): GetTableUnderstandingResultResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.id)) {
    query['Id'] = request.id;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'GetTableUnderstandingResult',
    version = '2022-07-11',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary 表格智能解析结果查询
 *
 * @param request GetTableUnderstandingResultRequest
 * @return GetTableUnderstandingResultResponse
 */
async function getTableUnderstandingResult(request: GetTableUnderstandingResultRequest): GetTableUnderstandingResultResponse {
  var runtime = new Util.RuntimeOptions{};
  return getTableUnderstandingResultWithOptions(request, runtime);
}

model QueryDocParserStatusRequest {
  id?: string(name='Id', example='docmind-20220816-1e89d65c'),
}

model QueryDocParserStatusResponseBody = {
  code?: string(name='Code', example='noPermission'),
  data?: {
    imageCount?: int32(name='ImageCount'),
    numberOfSuccessfulParsing?: int32(name='NumberOfSuccessfulParsing'),
    pageCountEstimate?: int32(name='PageCountEstimate'),
    paragraphCount?: int32(name='ParagraphCount'),
    status?: string(name='Status'),
    tableCount?: int32(name='TableCount'),
    tokens?: long(name='Tokens'),
  }(name='Data'),
  message?: string(name='Message', example='You are not authorized to perform this operation.'),
  requestId?: string(name='RequestId', example='43A29C77-405E-4CC0-BC55-EE694AD00655'),
}

model QueryDocParserStatusResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: QueryDocParserStatusResponseBody(name='body'),
}

/**
 * @summary 获取文档智能解析处理状态
 *
 * @param request QueryDocParserStatusRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return QueryDocParserStatusResponse
 */
async function queryDocParserStatusWithOptions(request: QueryDocParserStatusRequest, runtime: Util.RuntimeOptions): QueryDocParserStatusResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.id)) {
    query['Id'] = request.id;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'QueryDocParserStatus',
    version = '2022-07-11',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary 获取文档智能解析处理状态
 *
 * @param request QueryDocParserStatusRequest
 * @return QueryDocParserStatusResponse
 */
async function queryDocParserStatus(request: QueryDocParserStatusRequest): QueryDocParserStatusResponse {
  var runtime = new Util.RuntimeOptions{};
  return queryDocParserStatusWithOptions(request, runtime);
}

model SubmitConvertImageToExcelJobRequest {
  forceMergeExcel?: boolean(name='ForceMergeExcel'),
  imageNameExtension?: string(name='ImageNameExtension', example='jpg'),
  imageNames?: [ string ](name='ImageNames'),
  imageUrls?: [ string ](name='ImageUrls'),
  ossBucket?: string(name='OssBucket'),
  ossEndpoint?: string(name='OssEndpoint'),
}

model SubmitConvertImageToExcelJobShrinkRequest {
  forceMergeExcel?: boolean(name='ForceMergeExcel'),
  imageNameExtension?: string(name='ImageNameExtension', example='jpg'),
  imageNamesShrink?: string(name='ImageNames'),
  imageUrlsShrink?: string(name='ImageUrls'),
  ossBucket?: string(name='OssBucket'),
  ossEndpoint?: string(name='OssEndpoint'),
}

model SubmitConvertImageToExcelJobResponseBody = {
  code?: string(name='Code', example='noPermission'),
  data?: {
    id?: string(name='Id', example='docmind-20220810-7c5f9dd4'),
  }(name='Data'),
  message?: string(name='Message', example='You are not authorized to perform this operation.'),
  requestId?: string(name='RequestId', example='43A29C77-405E-4CC0-BC55-EE694AD00655'),
}

model SubmitConvertImageToExcelJobResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: SubmitConvertImageToExcelJobResponseBody(name='body'),
}

/**
 * @summary 图片转excel
 *
 * @param tmpReq SubmitConvertImageToExcelJobRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return SubmitConvertImageToExcelJobResponse
 */
async function submitConvertImageToExcelJobWithOptions(tmpReq: SubmitConvertImageToExcelJobRequest, runtime: Util.RuntimeOptions): SubmitConvertImageToExcelJobResponse {
  Util.validateModel(tmpReq);
  var request = new SubmitConvertImageToExcelJobShrinkRequest{};
  OpenApiUtil.convert(tmpReq, request);
  if (!Util.isUnset(tmpReq.imageNames)) {
    request.imageNamesShrink = OpenApiUtil.arrayToStringWithSpecifiedStyle(tmpReq.imageNames, 'ImageNames', 'simple');
  }
  if (!Util.isUnset(tmpReq.imageUrls)) {
    request.imageUrlsShrink = OpenApiUtil.arrayToStringWithSpecifiedStyle(tmpReq.imageUrls, 'ImageUrls', 'simple');
  }
  var query = {};
  if (!Util.isUnset(request.forceMergeExcel)) {
    query['ForceMergeExcel'] = request.forceMergeExcel;
  }
  if (!Util.isUnset(request.imageNameExtension)) {
    query['ImageNameExtension'] = request.imageNameExtension;
  }
  if (!Util.isUnset(request.imageNamesShrink)) {
    query['ImageNames'] = request.imageNamesShrink;
  }
  if (!Util.isUnset(request.imageUrlsShrink)) {
    query['ImageUrls'] = request.imageUrlsShrink;
  }
  if (!Util.isUnset(request.ossBucket)) {
    query['OssBucket'] = request.ossBucket;
  }
  if (!Util.isUnset(request.ossEndpoint)) {
    query['OssEndpoint'] = request.ossEndpoint;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'SubmitConvertImageToExcelJob',
    version = '2022-07-11',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary 图片转excel
 *
 * @param request SubmitConvertImageToExcelJobRequest
 * @return SubmitConvertImageToExcelJobResponse
 */
async function submitConvertImageToExcelJob(request: SubmitConvertImageToExcelJobRequest): SubmitConvertImageToExcelJobResponse {
  var runtime = new Util.RuntimeOptions{};
  return submitConvertImageToExcelJobWithOptions(request, runtime);
}

model SubmitConvertImageToMarkdownJobRequest {
  imageNameExtension?: string(name='ImageNameExtension', example='jpg'),
  imageNames?: [ string ](name='ImageNames'),
  imageUrls?: [ string ](name='ImageUrls'),
  ossBucket?: string(name='OssBucket'),
  ossEndpoint?: string(name='OssEndpoint'),
}

model SubmitConvertImageToMarkdownJobShrinkRequest {
  imageNameExtension?: string(name='ImageNameExtension', example='jpg'),
  imageNamesShrink?: string(name='ImageNames'),
  imageUrlsShrink?: string(name='ImageUrls'),
  ossBucket?: string(name='OssBucket'),
  ossEndpoint?: string(name='OssEndpoint'),
}

model SubmitConvertImageToMarkdownJobResponseBody = {
  code?: string(name='Code', example='noPermission'),
  data?: {
    id?: string(name='Id', example='docmind-20220810-7c5f9dd4'),
  }(name='Data'),
  message?: string(name='Message', example='You are not authorized to perform this operation.'),
  requestId?: string(name='RequestId', example='43A29C77-405E-4CC0-BC55-EE694AD00655'),
}

model SubmitConvertImageToMarkdownJobResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: SubmitConvertImageToMarkdownJobResponseBody(name='body'),
}

/**
 * @summary 图片转markdown
 *
 * @param tmpReq SubmitConvertImageToMarkdownJobRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return SubmitConvertImageToMarkdownJobResponse
 */
async function submitConvertImageToMarkdownJobWithOptions(tmpReq: SubmitConvertImageToMarkdownJobRequest, runtime: Util.RuntimeOptions): SubmitConvertImageToMarkdownJobResponse {
  Util.validateModel(tmpReq);
  var request = new SubmitConvertImageToMarkdownJobShrinkRequest{};
  OpenApiUtil.convert(tmpReq, request);
  if (!Util.isUnset(tmpReq.imageNames)) {
    request.imageNamesShrink = OpenApiUtil.arrayToStringWithSpecifiedStyle(tmpReq.imageNames, 'ImageNames', 'simple');
  }
  if (!Util.isUnset(tmpReq.imageUrls)) {
    request.imageUrlsShrink = OpenApiUtil.arrayToStringWithSpecifiedStyle(tmpReq.imageUrls, 'ImageUrls', 'simple');
  }
  var query = {};
  if (!Util.isUnset(request.imageNameExtension)) {
    query['ImageNameExtension'] = request.imageNameExtension;
  }
  if (!Util.isUnset(request.imageNamesShrink)) {
    query['ImageNames'] = request.imageNamesShrink;
  }
  if (!Util.isUnset(request.imageUrlsShrink)) {
    query['ImageUrls'] = request.imageUrlsShrink;
  }
  if (!Util.isUnset(request.ossBucket)) {
    query['OssBucket'] = request.ossBucket;
  }
  if (!Util.isUnset(request.ossEndpoint)) {
    query['OssEndpoint'] = request.ossEndpoint;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'SubmitConvertImageToMarkdownJob',
    version = '2022-07-11',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary 图片转markdown
 *
 * @param request SubmitConvertImageToMarkdownJobRequest
 * @return SubmitConvertImageToMarkdownJobResponse
 */
async function submitConvertImageToMarkdownJob(request: SubmitConvertImageToMarkdownJobRequest): SubmitConvertImageToMarkdownJobResponse {
  var runtime = new Util.RuntimeOptions{};
  return submitConvertImageToMarkdownJobWithOptions(request, runtime);
}

model SubmitConvertImageToPdfJobRequest {
  imageNameExtension?: string(name='ImageNameExtension', example='JPG'),
  imageNames?: [ string ](name='ImageNames'),
  imageUrls?: [ string ](name='ImageUrls'),
  ossBucket?: string(name='OssBucket'),
  ossEndpoint?: string(name='OssEndpoint'),
}

model SubmitConvertImageToPdfJobShrinkRequest {
  imageNameExtension?: string(name='ImageNameExtension', example='JPG'),
  imageNamesShrink?: string(name='ImageNames'),
  imageUrlsShrink?: string(name='ImageUrls'),
  ossBucket?: string(name='OssBucket'),
  ossEndpoint?: string(name='OssEndpoint'),
}

model SubmitConvertImageToPdfJobResponseBody = {
  code?: string(name='Code', example='noPermission'),
  data?: {
    id?: string(name='Id', example='docmind-20220810-7c5f9dd4'),
  }(name='Data'),
  message?: string(name='Message', example='You are not authorized to perform this operation.'),
  requestId?: string(name='RequestId', example='43A29C77-405E-4CC0-BC55-EE694AD00655'),
}

model SubmitConvertImageToPdfJobResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: SubmitConvertImageToPdfJobResponseBody(name='body'),
}

/**
 * @summary 图片转pdf
 *
 * @param tmpReq SubmitConvertImageToPdfJobRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return SubmitConvertImageToPdfJobResponse
 */
async function submitConvertImageToPdfJobWithOptions(tmpReq: SubmitConvertImageToPdfJobRequest, runtime: Util.RuntimeOptions): SubmitConvertImageToPdfJobResponse {
  Util.validateModel(tmpReq);
  var request = new SubmitConvertImageToPdfJobShrinkRequest{};
  OpenApiUtil.convert(tmpReq, request);
  if (!Util.isUnset(tmpReq.imageNames)) {
    request.imageNamesShrink = OpenApiUtil.arrayToStringWithSpecifiedStyle(tmpReq.imageNames, 'ImageNames', 'simple');
  }
  if (!Util.isUnset(tmpReq.imageUrls)) {
    request.imageUrlsShrink = OpenApiUtil.arrayToStringWithSpecifiedStyle(tmpReq.imageUrls, 'ImageUrls', 'simple');
  }
  var query = {};
  if (!Util.isUnset(request.imageNameExtension)) {
    query['ImageNameExtension'] = request.imageNameExtension;
  }
  if (!Util.isUnset(request.imageNamesShrink)) {
    query['ImageNames'] = request.imageNamesShrink;
  }
  if (!Util.isUnset(request.imageUrlsShrink)) {
    query['ImageUrls'] = request.imageUrlsShrink;
  }
  if (!Util.isUnset(request.ossBucket)) {
    query['OssBucket'] = request.ossBucket;
  }
  if (!Util.isUnset(request.ossEndpoint)) {
    query['OssEndpoint'] = request.ossEndpoint;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'SubmitConvertImageToPdfJob',
    version = '2022-07-11',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary 图片转pdf
 *
 * @param request SubmitConvertImageToPdfJobRequest
 * @return SubmitConvertImageToPdfJobResponse
 */
async function submitConvertImageToPdfJob(request: SubmitConvertImageToPdfJobRequest): SubmitConvertImageToPdfJobResponse {
  var runtime = new Util.RuntimeOptions{};
  return submitConvertImageToPdfJobWithOptions(request, runtime);
}

model SubmitConvertImageToWordJobRequest {
  imageNameExtension?: string(name='ImageNameExtension', example='jpg'),
  imageNames?: [ string ](name='ImageNames'),
  imageUrls?: [ string ](name='ImageUrls'),
  ossBucket?: string(name='OssBucket'),
  ossEndpoint?: string(name='OssEndpoint'),
}

model SubmitConvertImageToWordJobShrinkRequest {
  imageNameExtension?: string(name='ImageNameExtension', example='jpg'),
  imageNamesShrink?: string(name='ImageNames'),
  imageUrlsShrink?: string(name='ImageUrls'),
  ossBucket?: string(name='OssBucket'),
  ossEndpoint?: string(name='OssEndpoint'),
}

model SubmitConvertImageToWordJobResponseBody = {
  code?: string(name='Code', example='noPermission'),
  data?: {
    id?: string(name='Id', example='docmind-20220810-7c5f9dd4'),
  }(name='Data'),
  message?: string(name='Message', example='You are not authorized to perform this operation.'),
  requestId?: string(name='RequestId', example='43A29C77-405E-4CC0-BC55-EE694AD00655'),
}

model SubmitConvertImageToWordJobResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: SubmitConvertImageToWordJobResponseBody(name='body'),
}

/**
 * @summary 图片转word
 *
 * @param tmpReq SubmitConvertImageToWordJobRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return SubmitConvertImageToWordJobResponse
 */
async function submitConvertImageToWordJobWithOptions(tmpReq: SubmitConvertImageToWordJobRequest, runtime: Util.RuntimeOptions): SubmitConvertImageToWordJobResponse {
  Util.validateModel(tmpReq);
  var request = new SubmitConvertImageToWordJobShrinkRequest{};
  OpenApiUtil.convert(tmpReq, request);
  if (!Util.isUnset(tmpReq.imageNames)) {
    request.imageNamesShrink = OpenApiUtil.arrayToStringWithSpecifiedStyle(tmpReq.imageNames, 'ImageNames', 'simple');
  }
  if (!Util.isUnset(tmpReq.imageUrls)) {
    request.imageUrlsShrink = OpenApiUtil.arrayToStringWithSpecifiedStyle(tmpReq.imageUrls, 'ImageUrls', 'simple');
  }
  var query = {};
  if (!Util.isUnset(request.imageNameExtension)) {
    query['ImageNameExtension'] = request.imageNameExtension;
  }
  if (!Util.isUnset(request.imageNamesShrink)) {
    query['ImageNames'] = request.imageNamesShrink;
  }
  if (!Util.isUnset(request.imageUrlsShrink)) {
    query['ImageUrls'] = request.imageUrlsShrink;
  }
  if (!Util.isUnset(request.ossBucket)) {
    query['OssBucket'] = request.ossBucket;
  }
  if (!Util.isUnset(request.ossEndpoint)) {
    query['OssEndpoint'] = request.ossEndpoint;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'SubmitConvertImageToWordJob',
    version = '2022-07-11',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary 图片转word
 *
 * @param request SubmitConvertImageToWordJobRequest
 * @return SubmitConvertImageToWordJobResponse
 */
async function submitConvertImageToWordJob(request: SubmitConvertImageToWordJobRequest): SubmitConvertImageToWordJobResponse {
  var runtime = new Util.RuntimeOptions{};
  return submitConvertImageToWordJobWithOptions(request, runtime);
}

model SubmitConvertPdfToExcelJobRequest {
  fileName?: string(name='FileName', example='convertPdfToExcel.pdf'),
  fileUrl?: string(name='FileUrl', example='https://gw.alipayobjects.com/os/basement_prod/598b9edf-5287-4065-9e36-464305c60698.pdf'),
  forceExportInnerImage?: boolean(name='ForceExportInnerImage'),
  forceMergeExcel?: boolean(name='ForceMergeExcel'),
  ossBucket?: string(name='OssBucket'),
  ossEndpoint?: string(name='OssEndpoint'),
}

model SubmitConvertPdfToExcelJobAdvanceRequest {
  fileName?: string(name='FileName', example='convertPdfToExcel.pdf'),
  fileUrlObject?: readable(name='FileUrl', example='https://gw.alipayobjects.com/os/basement_prod/598b9edf-5287-4065-9e36-464305c60698.pdf'),
  forceExportInnerImage?: boolean(name='ForceExportInnerImage'),
  forceMergeExcel?: boolean(name='ForceMergeExcel'),
  ossBucket?: string(name='OssBucket'),
  ossEndpoint?: string(name='OssEndpoint'),
}

model SubmitConvertPdfToExcelJobResponseBody = {
  code?: string(name='Code', example='noPermission'),
  data?: {
    id?: string(name='Id', example='docmind-20220816-15bc7965'),
  }(name='Data'),
  message?: string(name='Message', example='You are not authorized to perform this operation.'),
  requestId?: string(name='RequestId', example='43A29C77-405E-4CC0-BC55-EE694AD00655'),
}

model SubmitConvertPdfToExcelJobResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: SubmitConvertPdfToExcelJobResponseBody(name='body'),
}

/**
 * @summary pdf转excel
 *
 * @param request SubmitConvertPdfToExcelJobRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return SubmitConvertPdfToExcelJobResponse
 */
async function submitConvertPdfToExcelJobWithOptions(request: SubmitConvertPdfToExcelJobRequest, runtime: Util.RuntimeOptions): SubmitConvertPdfToExcelJobResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.fileName)) {
    query['FileName'] = request.fileName;
  }
  if (!Util.isUnset(request.fileUrl)) {
    query['FileUrl'] = request.fileUrl;
  }
  if (!Util.isUnset(request.forceExportInnerImage)) {
    query['ForceExportInnerImage'] = request.forceExportInnerImage;
  }
  if (!Util.isUnset(request.forceMergeExcel)) {
    query['ForceMergeExcel'] = request.forceMergeExcel;
  }
  if (!Util.isUnset(request.ossBucket)) {
    query['OssBucket'] = request.ossBucket;
  }
  if (!Util.isUnset(request.ossEndpoint)) {
    query['OssEndpoint'] = request.ossEndpoint;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'SubmitConvertPdfToExcelJob',
    version = '2022-07-11',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary pdf转excel
 *
 * @param request SubmitConvertPdfToExcelJobRequest
 * @return SubmitConvertPdfToExcelJobResponse
 */
async function submitConvertPdfToExcelJob(request: SubmitConvertPdfToExcelJobRequest): SubmitConvertPdfToExcelJobResponse {
  var runtime = new Util.RuntimeOptions{};
  return submitConvertPdfToExcelJobWithOptions(request, runtime);
}

async function submitConvertPdfToExcelJobAdvance(request: SubmitConvertPdfToExcelJobAdvanceRequest, runtime: Util.RuntimeOptions): SubmitConvertPdfToExcelJobResponse {
  // Step 0: init client
  var accessKeyId = @credential.getAccessKeyId();
  var accessKeySecret = @credential.getAccessKeySecret();
  var securityToken = @credential.getSecurityToken();
  var credentialType = @credential.getType();
  var openPlatformEndpoint = @openPlatformEndpoint;
  if(Util.empty(openPlatformEndpoint)) {
    openPlatformEndpoint ='openplatform.aliyuncs.com';
  }
  if(Util.isUnset(credentialType)) {
    credentialType ='access_key';
  }
  var authConfig = new OpenApi.Config{
    accessKeyId = accessKeyId,
    accessKeySecret = accessKeySecret,
    securityToken = securityToken,
    type = credentialType,
    endpoint = openPlatformEndpoint,
    protocol = @protocol,
    regionId = @regionId,
  };
  var authClient = new OpenPlatform(authConfig);
  var authRequest = new OpenPlatform.AuthorizeFileUploadRequest{
    product = 'docmind-api',
    regionId = @regionId,
  };
  var authResponse = new OpenPlatform.AuthorizeFileUploadResponse{};
  var ossConfig = new OSS.Config{
    accessKeyId = accessKeyId,
    accessKeySecret = accessKeySecret,
    type = 'access_key',
    protocol = @protocol,
    regionId = @regionId,
  };
  var ossClient : OSS = new OSS(ossConfig);

  var fileObj = new FileForm.FileField{};
  var ossHeader = new OSS.PostObjectRequest.header{};
  var uploadRequest = new OSS.PostObjectRequest{};
  var ossRuntime = new OSSUtil.RuntimeOptions{};
  OpenApiUtil.convert(runtime, ossRuntime);
  var submitConvertPdfToExcelJobReq = new SubmitConvertPdfToExcelJobRequest{};
  OpenApiUtil.convert(request, submitConvertPdfToExcelJobReq);

  if(!Util.isUnset(request.fileUrlObject)) {
    authResponse = authClient.authorizeFileUploadWithOptions(authRequest, runtime);
    ossConfig.accessKeyId = authResponse.body.accessKeyId;
    ossConfig.endpoint = OpenApiUtil.getEndpoint(authResponse.body.endpoint, authResponse.body.useAccelerate, @endpointType);
    ossClient = new OSS(ossConfig);

    fileObj = new FileForm.FileField{
      filename = authResponse.body.objectKey,
      content = request.fileUrlObject,
      contentType = '',
    };
    ossHeader = new OSS.PostObjectRequest.header{
      accessKeyId = authResponse.body.accessKeyId,
      policy = authResponse.body.encodedPolicy,
      signature = authResponse.body.signature,
      key = authResponse.body.objectKey,
      file = fileObj,
      successActionStatus = '201',
    };
    uploadRequest = new OSS.PostObjectRequest{
      bucketName = authResponse.body.bucket,
      header = ossHeader,
    };
    ossClient.postObject(uploadRequest, ossRuntime);
    submitConvertPdfToExcelJobReq.fileUrl = `http://${authResponse.body.bucket}.${authResponse.body.endpoint}/${authResponse.body.objectKey}`;
  }
  var submitConvertPdfToExcelJobResp = submitConvertPdfToExcelJobWithOptions(submitConvertPdfToExcelJobReq, runtime);
  return submitConvertPdfToExcelJobResp;
}

model SubmitConvertPdfToImageJobRequest {
  fileName?: string(name='FileName', example='convertPdfToImage.pdf'),
  fileUrl?: string(name='FileUrl', example='https://gw.alipayobjects.com/os/basement_prod/598b9edf-5287-4065-9e36-464305c60698.pdf'),
  ossBucket?: string(name='OssBucket'),
  ossEndpoint?: string(name='OssEndpoint'),
}

model SubmitConvertPdfToImageJobAdvanceRequest {
  fileName?: string(name='FileName', example='convertPdfToImage.pdf'),
  fileUrlObject?: readable(name='FileUrl', example='https://gw.alipayobjects.com/os/basement_prod/598b9edf-5287-4065-9e36-464305c60698.pdf'),
  ossBucket?: string(name='OssBucket'),
  ossEndpoint?: string(name='OssEndpoint'),
}

model SubmitConvertPdfToImageJobResponseBody = {
  code?: string(name='Code', example='noPermission'),
  data?: {
    id?: string(name='Id', example='docmind-20220810-7c5f9dd4'),
  }(name='Data'),
  message?: string(name='Message', example='You are not authorized to perform this operation.'),
  requestId?: string(name='RequestId', example='43A29C77-405E-4CC0-BC55-EE694AD00655'),
}

model SubmitConvertPdfToImageJobResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: SubmitConvertPdfToImageJobResponseBody(name='body'),
}

/**
 * @summary pdf转图片
 *
 * @param request SubmitConvertPdfToImageJobRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return SubmitConvertPdfToImageJobResponse
 */
async function submitConvertPdfToImageJobWithOptions(request: SubmitConvertPdfToImageJobRequest, runtime: Util.RuntimeOptions): SubmitConvertPdfToImageJobResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.fileName)) {
    query['FileName'] = request.fileName;
  }
  if (!Util.isUnset(request.fileUrl)) {
    query['FileUrl'] = request.fileUrl;
  }
  if (!Util.isUnset(request.ossBucket)) {
    query['OssBucket'] = request.ossBucket;
  }
  if (!Util.isUnset(request.ossEndpoint)) {
    query['OssEndpoint'] = request.ossEndpoint;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'SubmitConvertPdfToImageJob',
    version = '2022-07-11',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary pdf转图片
 *
 * @param request SubmitConvertPdfToImageJobRequest
 * @return SubmitConvertPdfToImageJobResponse
 */
async function submitConvertPdfToImageJob(request: SubmitConvertPdfToImageJobRequest): SubmitConvertPdfToImageJobResponse {
  var runtime = new Util.RuntimeOptions{};
  return submitConvertPdfToImageJobWithOptions(request, runtime);
}

async function submitConvertPdfToImageJobAdvance(request: SubmitConvertPdfToImageJobAdvanceRequest, runtime: Util.RuntimeOptions): SubmitConvertPdfToImageJobResponse {
  // Step 0: init client
  var accessKeyId = @credential.getAccessKeyId();
  var accessKeySecret = @credential.getAccessKeySecret();
  var securityToken = @credential.getSecurityToken();
  var credentialType = @credential.getType();
  var openPlatformEndpoint = @openPlatformEndpoint;
  if(Util.empty(openPlatformEndpoint)) {
    openPlatformEndpoint ='openplatform.aliyuncs.com';
  }
  if(Util.isUnset(credentialType)) {
    credentialType ='access_key';
  }
  var authConfig = new OpenApi.Config{
    accessKeyId = accessKeyId,
    accessKeySecret = accessKeySecret,
    securityToken = securityToken,
    type = credentialType,
    endpoint = openPlatformEndpoint,
    protocol = @protocol,
    regionId = @regionId,
  };
  var authClient = new OpenPlatform(authConfig);
  var authRequest = new OpenPlatform.AuthorizeFileUploadRequest{
    product = 'docmind-api',
    regionId = @regionId,
  };
  var authResponse = new OpenPlatform.AuthorizeFileUploadResponse{};
  var ossConfig = new OSS.Config{
    accessKeyId = accessKeyId,
    accessKeySecret = accessKeySecret,
    type = 'access_key',
    protocol = @protocol,
    regionId = @regionId,
  };
  var ossClient : OSS = new OSS(ossConfig);

  var fileObj = new FileForm.FileField{};
  var ossHeader = new OSS.PostObjectRequest.header{};
  var uploadRequest = new OSS.PostObjectRequest{};
  var ossRuntime = new OSSUtil.RuntimeOptions{};
  OpenApiUtil.convert(runtime, ossRuntime);
  var submitConvertPdfToImageJobReq = new SubmitConvertPdfToImageJobRequest{};
  OpenApiUtil.convert(request, submitConvertPdfToImageJobReq);

  if(!Util.isUnset(request.fileUrlObject)) {
    authResponse = authClient.authorizeFileUploadWithOptions(authRequest, runtime);
    ossConfig.accessKeyId = authResponse.body.accessKeyId;
    ossConfig.endpoint = OpenApiUtil.getEndpoint(authResponse.body.endpoint, authResponse.body.useAccelerate, @endpointType);
    ossClient = new OSS(ossConfig);

    fileObj = new FileForm.FileField{
      filename = authResponse.body.objectKey,
      content = request.fileUrlObject,
      contentType = '',
    };
    ossHeader = new OSS.PostObjectRequest.header{
      accessKeyId = authResponse.body.accessKeyId,
      policy = authResponse.body.encodedPolicy,
      signature = authResponse.body.signature,
      key = authResponse.body.objectKey,
      file = fileObj,
      successActionStatus = '201',
    };
    uploadRequest = new OSS.PostObjectRequest{
      bucketName = authResponse.body.bucket,
      header = ossHeader,
    };
    ossClient.postObject(uploadRequest, ossRuntime);
    submitConvertPdfToImageJobReq.fileUrl = `http://${authResponse.body.bucket}.${authResponse.body.endpoint}/${authResponse.body.objectKey}`;
  }
  var submitConvertPdfToImageJobResp = submitConvertPdfToImageJobWithOptions(submitConvertPdfToImageJobReq, runtime);
  return submitConvertPdfToImageJobResp;
}

model SubmitConvertPdfToMarkdownJobRequest {
  fileName?: string(name='FileName', example='convertPdfToExcel.pdf'),
  fileUrl?: string(name='FileUrl', example='https://gw.alipayobjects.com/os/basement_prod/598b9edf-5287-4065-9e36-464305c60698.pdf'),
  ossBucket?: string(name='OssBucket'),
  ossEndpoint?: string(name='OssEndpoint'),
}

model SubmitConvertPdfToMarkdownJobAdvanceRequest {
  fileName?: string(name='FileName', example='convertPdfToExcel.pdf'),
  fileUrlObject?: readable(name='FileUrl', example='https://gw.alipayobjects.com/os/basement_prod/598b9edf-5287-4065-9e36-464305c60698.pdf'),
  ossBucket?: string(name='OssBucket'),
  ossEndpoint?: string(name='OssEndpoint'),
}

model SubmitConvertPdfToMarkdownJobResponseBody = {
  code?: string(name='Code', example='noPermission'),
  data?: {
    id?: string(name='Id', example='docmind-20220816-15bc7965'),
  }(name='Data'),
  message?: string(name='Message', example='You are not authorized to perform this operation.'),
  requestId?: string(name='RequestId', example='43A29C77-405E-4CC0-BC55-EE694AD00655'),
}

model SubmitConvertPdfToMarkdownJobResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: SubmitConvertPdfToMarkdownJobResponseBody(name='body'),
}

/**
 * @summary pdf转markdown
 *
 * @param request SubmitConvertPdfToMarkdownJobRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return SubmitConvertPdfToMarkdownJobResponse
 */
async function submitConvertPdfToMarkdownJobWithOptions(request: SubmitConvertPdfToMarkdownJobRequest, runtime: Util.RuntimeOptions): SubmitConvertPdfToMarkdownJobResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.fileName)) {
    query['FileName'] = request.fileName;
  }
  if (!Util.isUnset(request.fileUrl)) {
    query['FileUrl'] = request.fileUrl;
  }
  if (!Util.isUnset(request.ossBucket)) {
    query['OssBucket'] = request.ossBucket;
  }
  if (!Util.isUnset(request.ossEndpoint)) {
    query['OssEndpoint'] = request.ossEndpoint;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'SubmitConvertPdfToMarkdownJob',
    version = '2022-07-11',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary pdf转markdown
 *
 * @param request SubmitConvertPdfToMarkdownJobRequest
 * @return SubmitConvertPdfToMarkdownJobResponse
 */
async function submitConvertPdfToMarkdownJob(request: SubmitConvertPdfToMarkdownJobRequest): SubmitConvertPdfToMarkdownJobResponse {
  var runtime = new Util.RuntimeOptions{};
  return submitConvertPdfToMarkdownJobWithOptions(request, runtime);
}

async function submitConvertPdfToMarkdownJobAdvance(request: SubmitConvertPdfToMarkdownJobAdvanceRequest, runtime: Util.RuntimeOptions): SubmitConvertPdfToMarkdownJobResponse {
  // Step 0: init client
  var accessKeyId = @credential.getAccessKeyId();
  var accessKeySecret = @credential.getAccessKeySecret();
  var securityToken = @credential.getSecurityToken();
  var credentialType = @credential.getType();
  var openPlatformEndpoint = @openPlatformEndpoint;
  if(Util.empty(openPlatformEndpoint)) {
    openPlatformEndpoint ='openplatform.aliyuncs.com';
  }
  if(Util.isUnset(credentialType)) {
    credentialType ='access_key';
  }
  var authConfig = new OpenApi.Config{
    accessKeyId = accessKeyId,
    accessKeySecret = accessKeySecret,
    securityToken = securityToken,
    type = credentialType,
    endpoint = openPlatformEndpoint,
    protocol = @protocol,
    regionId = @regionId,
  };
  var authClient = new OpenPlatform(authConfig);
  var authRequest = new OpenPlatform.AuthorizeFileUploadRequest{
    product = 'docmind-api',
    regionId = @regionId,
  };
  var authResponse = new OpenPlatform.AuthorizeFileUploadResponse{};
  var ossConfig = new OSS.Config{
    accessKeyId = accessKeyId,
    accessKeySecret = accessKeySecret,
    type = 'access_key',
    protocol = @protocol,
    regionId = @regionId,
  };
  var ossClient : OSS = new OSS(ossConfig);

  var fileObj = new FileForm.FileField{};
  var ossHeader = new OSS.PostObjectRequest.header{};
  var uploadRequest = new OSS.PostObjectRequest{};
  var ossRuntime = new OSSUtil.RuntimeOptions{};
  OpenApiUtil.convert(runtime, ossRuntime);
  var submitConvertPdfToMarkdownJobReq = new SubmitConvertPdfToMarkdownJobRequest{};
  OpenApiUtil.convert(request, submitConvertPdfToMarkdownJobReq);

  if(!Util.isUnset(request.fileUrlObject)) {
    authResponse = authClient.authorizeFileUploadWithOptions(authRequest, runtime);
    ossConfig.accessKeyId = authResponse.body.accessKeyId;
    ossConfig.endpoint = OpenApiUtil.getEndpoint(authResponse.body.endpoint, authResponse.body.useAccelerate, @endpointType);
    ossClient = new OSS(ossConfig);

    fileObj = new FileForm.FileField{
      filename = authResponse.body.objectKey,
      content = request.fileUrlObject,
      contentType = '',
    };
    ossHeader = new OSS.PostObjectRequest.header{
      accessKeyId = authResponse.body.accessKeyId,
      policy = authResponse.body.encodedPolicy,
      signature = authResponse.body.signature,
      key = authResponse.body.objectKey,
      file = fileObj,
      successActionStatus = '201',
    };
    uploadRequest = new OSS.PostObjectRequest{
      bucketName = authResponse.body.bucket,
      header = ossHeader,
    };
    ossClient.postObject(uploadRequest, ossRuntime);
    submitConvertPdfToMarkdownJobReq.fileUrl = `http://${authResponse.body.bucket}.${authResponse.body.endpoint}/${authResponse.body.objectKey}`;
  }
  var submitConvertPdfToMarkdownJobResp = submitConvertPdfToMarkdownJobWithOptions(submitConvertPdfToMarkdownJobReq, runtime);
  return submitConvertPdfToMarkdownJobResp;
}

model SubmitConvertPdfToWordJobRequest {
  fileName?: string(name='FileName', example='covertPdfToWord.pdf'),
  fileUrl?: string(name='FileUrl', example='https://gw.alipayobjects.com/os/basement_prod/598b9edf-5287-4065-9e36-464305c60698.pdf'),
  forceExportInnerImage?: boolean(name='ForceExportInnerImage'),
  formulaEnhancement?: boolean(name='FormulaEnhancement'),
  option?: string(name='Option'),
  ossBucket?: string(name='OssBucket'),
  ossEndpoint?: string(name='OssEndpoint'),
}

model SubmitConvertPdfToWordJobAdvanceRequest {
  fileName?: string(name='FileName', example='covertPdfToWord.pdf'),
  fileUrlObject?: readable(name='FileUrl', example='https://gw.alipayobjects.com/os/basement_prod/598b9edf-5287-4065-9e36-464305c60698.pdf'),
  forceExportInnerImage?: boolean(name='ForceExportInnerImage'),
  formulaEnhancement?: boolean(name='FormulaEnhancement'),
  option?: string(name='Option'),
  ossBucket?: string(name='OssBucket'),
  ossEndpoint?: string(name='OssEndpoint'),
}

model SubmitConvertPdfToWordJobResponseBody = {
  code?: string(name='Code', example='noPermission'),
  data?: {
    id?: string(name='Id', example='docmind-20220816-15bc7965'),
  }(name='Data'),
  message?: string(name='Message', example='You are not authorized to perform this operation.'),
  requestId?: string(name='RequestId', example='43A29C77-405E-4CC0-BC55-EE694AD00655'),
}

model SubmitConvertPdfToWordJobResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: SubmitConvertPdfToWordJobResponseBody(name='body'),
}

/**
 * @summary pdf转word
 *
 * @param request SubmitConvertPdfToWordJobRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return SubmitConvertPdfToWordJobResponse
 */
async function submitConvertPdfToWordJobWithOptions(request: SubmitConvertPdfToWordJobRequest, runtime: Util.RuntimeOptions): SubmitConvertPdfToWordJobResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.fileName)) {
    query['FileName'] = request.fileName;
  }
  if (!Util.isUnset(request.fileUrl)) {
    query['FileUrl'] = request.fileUrl;
  }
  if (!Util.isUnset(request.forceExportInnerImage)) {
    query['ForceExportInnerImage'] = request.forceExportInnerImage;
  }
  if (!Util.isUnset(request.formulaEnhancement)) {
    query['FormulaEnhancement'] = request.formulaEnhancement;
  }
  if (!Util.isUnset(request.option)) {
    query['Option'] = request.option;
  }
  if (!Util.isUnset(request.ossBucket)) {
    query['OssBucket'] = request.ossBucket;
  }
  if (!Util.isUnset(request.ossEndpoint)) {
    query['OssEndpoint'] = request.ossEndpoint;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'SubmitConvertPdfToWordJob',
    version = '2022-07-11',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary pdf转word
 *
 * @param request SubmitConvertPdfToWordJobRequest
 * @return SubmitConvertPdfToWordJobResponse
 */
async function submitConvertPdfToWordJob(request: SubmitConvertPdfToWordJobRequest): SubmitConvertPdfToWordJobResponse {
  var runtime = new Util.RuntimeOptions{};
  return submitConvertPdfToWordJobWithOptions(request, runtime);
}

async function submitConvertPdfToWordJobAdvance(request: SubmitConvertPdfToWordJobAdvanceRequest, runtime: Util.RuntimeOptions): SubmitConvertPdfToWordJobResponse {
  // Step 0: init client
  var accessKeyId = @credential.getAccessKeyId();
  var accessKeySecret = @credential.getAccessKeySecret();
  var securityToken = @credential.getSecurityToken();
  var credentialType = @credential.getType();
  var openPlatformEndpoint = @openPlatformEndpoint;
  if(Util.empty(openPlatformEndpoint)) {
    openPlatformEndpoint ='openplatform.aliyuncs.com';
  }
  if(Util.isUnset(credentialType)) {
    credentialType ='access_key';
  }
  var authConfig = new OpenApi.Config{
    accessKeyId = accessKeyId,
    accessKeySecret = accessKeySecret,
    securityToken = securityToken,
    type = credentialType,
    endpoint = openPlatformEndpoint,
    protocol = @protocol,
    regionId = @regionId,
  };
  var authClient = new OpenPlatform(authConfig);
  var authRequest = new OpenPlatform.AuthorizeFileUploadRequest{
    product = 'docmind-api',
    regionId = @regionId,
  };
  var authResponse = new OpenPlatform.AuthorizeFileUploadResponse{};
  var ossConfig = new OSS.Config{
    accessKeyId = accessKeyId,
    accessKeySecret = accessKeySecret,
    type = 'access_key',
    protocol = @protocol,
    regionId = @regionId,
  };
  var ossClient : OSS = new OSS(ossConfig);

  var fileObj = new FileForm.FileField{};
  var ossHeader = new OSS.PostObjectRequest.header{};
  var uploadRequest = new OSS.PostObjectRequest{};
  var ossRuntime = new OSSUtil.RuntimeOptions{};
  OpenApiUtil.convert(runtime, ossRuntime);
  var submitConvertPdfToWordJobReq = new SubmitConvertPdfToWordJobRequest{};
  OpenApiUtil.convert(request, submitConvertPdfToWordJobReq);

  if(!Util.isUnset(request.fileUrlObject)) {
    authResponse = authClient.authorizeFileUploadWithOptions(authRequest, runtime);
    ossConfig.accessKeyId = authResponse.body.accessKeyId;
    ossConfig.endpoint = OpenApiUtil.getEndpoint(authResponse.body.endpoint, authResponse.body.useAccelerate, @endpointType);
    ossClient = new OSS(ossConfig);

    fileObj = new FileForm.FileField{
      filename = authResponse.body.objectKey,
      content = request.fileUrlObject,
      contentType = '',
    };
    ossHeader = new OSS.PostObjectRequest.header{
      accessKeyId = authResponse.body.accessKeyId,
      policy = authResponse.body.encodedPolicy,
      signature = authResponse.body.signature,
      key = authResponse.body.objectKey,
      file = fileObj,
      successActionStatus = '201',
    };
    uploadRequest = new OSS.PostObjectRequest{
      bucketName = authResponse.body.bucket,
      header = ossHeader,
    };
    ossClient.postObject(uploadRequest, ossRuntime);
    submitConvertPdfToWordJobReq.fileUrl = `http://${authResponse.body.bucket}.${authResponse.body.endpoint}/${authResponse.body.objectKey}`;
  }
  var submitConvertPdfToWordJobResp = submitConvertPdfToWordJobWithOptions(submitConvertPdfToWordJobReq, runtime);
  return submitConvertPdfToWordJobResp;
}

model SubmitDigitalDocStructureJobRequest {
  fileName?: string(name='FileName', example='docStructure.pdf'),
  fileNameExtension?: string(name='FileNameExtension', example='pdf'),
  fileUrl?: string(name='FileUrl', example='https://gw.alipayobjects.com/os/basement_prod/598b9edf-5287-4065-9e36-464305c60698.pdf'),
  imageStrategy?: string(name='ImageStrategy'),
  ossBucket?: string(name='OssBucket'),
  ossEndpoint?: string(name='OssEndpoint'),
  revealMarkdown?: boolean(name='RevealMarkdown'),
  useUrlResponseBody?: boolean(name='UseUrlResponseBody'),
}

model SubmitDigitalDocStructureJobAdvanceRequest {
  fileName?: string(name='FileName', example='docStructure.pdf'),
  fileNameExtension?: string(name='FileNameExtension', example='pdf'),
  fileUrlObject?: readable(name='FileUrl', example='https://gw.alipayobjects.com/os/basement_prod/598b9edf-5287-4065-9e36-464305c60698.pdf'),
  imageStrategy?: string(name='ImageStrategy'),
  ossBucket?: string(name='OssBucket'),
  ossEndpoint?: string(name='OssEndpoint'),
  revealMarkdown?: boolean(name='RevealMarkdown'),
  useUrlResponseBody?: boolean(name='UseUrlResponseBody'),
}

model SubmitDigitalDocStructureJobResponseBody = {
  code?: string(name='Code', example='noPermission'),
  data?: any(name='Data'),
  id?: string(name='Id'),
  message?: string(name='Message', example='You are not authorized to perform this operation.'),
  requestId?: string(name='RequestId', example='43A29C77-405E-4CC0-BC55-EE694AD00655'),
  status?: string(name='Status'),
}

model SubmitDigitalDocStructureJobResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: SubmitDigitalDocStructureJobResponseBody(name='body'),
}

/**
 * @summary 电子解析
 *
 * @param request SubmitDigitalDocStructureJobRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return SubmitDigitalDocStructureJobResponse
 */
async function submitDigitalDocStructureJobWithOptions(request: SubmitDigitalDocStructureJobRequest, runtime: Util.RuntimeOptions): SubmitDigitalDocStructureJobResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.fileName)) {
    query['FileName'] = request.fileName;
  }
  if (!Util.isUnset(request.fileNameExtension)) {
    query['FileNameExtension'] = request.fileNameExtension;
  }
  if (!Util.isUnset(request.fileUrl)) {
    query['FileUrl'] = request.fileUrl;
  }
  if (!Util.isUnset(request.imageStrategy)) {
    query['ImageStrategy'] = request.imageStrategy;
  }
  if (!Util.isUnset(request.ossBucket)) {
    query['OssBucket'] = request.ossBucket;
  }
  if (!Util.isUnset(request.ossEndpoint)) {
    query['OssEndpoint'] = request.ossEndpoint;
  }
  if (!Util.isUnset(request.revealMarkdown)) {
    query['RevealMarkdown'] = request.revealMarkdown;
  }
  if (!Util.isUnset(request.useUrlResponseBody)) {
    query['UseUrlResponseBody'] = request.useUrlResponseBody;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'SubmitDigitalDocStructureJob',
    version = '2022-07-11',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary 电子解析
 *
 * @param request SubmitDigitalDocStructureJobRequest
 * @return SubmitDigitalDocStructureJobResponse
 */
async function submitDigitalDocStructureJob(request: SubmitDigitalDocStructureJobRequest): SubmitDigitalDocStructureJobResponse {
  var runtime = new Util.RuntimeOptions{};
  return submitDigitalDocStructureJobWithOptions(request, runtime);
}

async function submitDigitalDocStructureJobAdvance(request: SubmitDigitalDocStructureJobAdvanceRequest, runtime: Util.RuntimeOptions): SubmitDigitalDocStructureJobResponse {
  // Step 0: init client
  var accessKeyId = @credential.getAccessKeyId();
  var accessKeySecret = @credential.getAccessKeySecret();
  var securityToken = @credential.getSecurityToken();
  var credentialType = @credential.getType();
  var openPlatformEndpoint = @openPlatformEndpoint;
  if(Util.empty(openPlatformEndpoint)) {
    openPlatformEndpoint ='openplatform.aliyuncs.com';
  }
  if(Util.isUnset(credentialType)) {
    credentialType ='access_key';
  }
  var authConfig = new OpenApi.Config{
    accessKeyId = accessKeyId,
    accessKeySecret = accessKeySecret,
    securityToken = securityToken,
    type = credentialType,
    endpoint = openPlatformEndpoint,
    protocol = @protocol,
    regionId = @regionId,
  };
  var authClient = new OpenPlatform(authConfig);
  var authRequest = new OpenPlatform.AuthorizeFileUploadRequest{
    product = 'docmind-api',
    regionId = @regionId,
  };
  var authResponse = new OpenPlatform.AuthorizeFileUploadResponse{};
  var ossConfig = new OSS.Config{
    accessKeyId = accessKeyId,
    accessKeySecret = accessKeySecret,
    type = 'access_key',
    protocol = @protocol,
    regionId = @regionId,
  };
  var ossClient : OSS = new OSS(ossConfig);

  var fileObj = new FileForm.FileField{};
  var ossHeader = new OSS.PostObjectRequest.header{};
  var uploadRequest = new OSS.PostObjectRequest{};
  var ossRuntime = new OSSUtil.RuntimeOptions{};
  OpenApiUtil.convert(runtime, ossRuntime);
  var submitDigitalDocStructureJobReq = new SubmitDigitalDocStructureJobRequest{};
  OpenApiUtil.convert(request, submitDigitalDocStructureJobReq);

  if(!Util.isUnset(request.fileUrlObject)) {
    authResponse = authClient.authorizeFileUploadWithOptions(authRequest, runtime);
    ossConfig.accessKeyId = authResponse.body.accessKeyId;
    ossConfig.endpoint = OpenApiUtil.getEndpoint(authResponse.body.endpoint, authResponse.body.useAccelerate, @endpointType);
    ossClient = new OSS(ossConfig);

    fileObj = new FileForm.FileField{
      filename = authResponse.body.objectKey,
      content = request.fileUrlObject,
      contentType = '',
    };
    ossHeader = new OSS.PostObjectRequest.header{
      accessKeyId = authResponse.body.accessKeyId,
      policy = authResponse.body.encodedPolicy,
      signature = authResponse.body.signature,
      key = authResponse.body.objectKey,
      file = fileObj,
      successActionStatus = '201',
    };
    uploadRequest = new OSS.PostObjectRequest{
      bucketName = authResponse.body.bucket,
      header = ossHeader,
    };
    ossClient.postObject(uploadRequest, ossRuntime);
    submitDigitalDocStructureJobReq.fileUrl = `http://${authResponse.body.bucket}.${authResponse.body.endpoint}/${authResponse.body.objectKey}`;
  }
  var submitDigitalDocStructureJobResp = submitDigitalDocStructureJobWithOptions(submitDigitalDocStructureJobReq, runtime);
  return submitDigitalDocStructureJobResp;
}

model SubmitDocParserJobRequest {
  fileName?: string(name='FileName', example='docStructure.pdf'),
  fileNameExtension?: string(name='FileNameExtension', example='pdf'),
  fileUrl?: string(name='FileUrl', example='https://gw.alipayobjects.com/os/basement_prod/598b9edf-5287-4065-9e36-464305c60698.pdf'),
  formulaEnhancement?: boolean(name='FormulaEnhancement'),
  llmEnhancement?: boolean(name='LlmEnhancement'),
  ossBucket?: string(name='OssBucket'),
  ossEndpoint?: string(name='OssEndpoint'),
}

model SubmitDocParserJobAdvanceRequest {
  fileName?: string(name='FileName', example='docStructure.pdf'),
  fileNameExtension?: string(name='FileNameExtension', example='pdf'),
  fileUrlObject?: readable(name='FileUrl', example='https://gw.alipayobjects.com/os/basement_prod/598b9edf-5287-4065-9e36-464305c60698.pdf'),
  formulaEnhancement?: boolean(name='FormulaEnhancement'),
  llmEnhancement?: boolean(name='LlmEnhancement'),
  ossBucket?: string(name='OssBucket'),
  ossEndpoint?: string(name='OssEndpoint'),
}

model SubmitDocParserJobResponseBody = {
  code?: string(name='Code', example='noPermission'),
  data?: {
    id?: string(name='Id', example='docmind-20220816-15bc7965'),
  }(name='Data'),
  message?: string(name='Message', example='You are not authorized to perform this operation.'),
  requestId?: string(name='RequestId', example='43A29C77-405E-4CC0-BC55-EE694AD00655'),
}

model SubmitDocParserJobResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: SubmitDocParserJobResponseBody(name='body'),
}

/**
 * @summary 文档智能解析流式输出
 *
 * @param request SubmitDocParserJobRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return SubmitDocParserJobResponse
 */
async function submitDocParserJobWithOptions(request: SubmitDocParserJobRequest, runtime: Util.RuntimeOptions): SubmitDocParserJobResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.fileName)) {
    query['FileName'] = request.fileName;
  }
  if (!Util.isUnset(request.fileNameExtension)) {
    query['FileNameExtension'] = request.fileNameExtension;
  }
  if (!Util.isUnset(request.fileUrl)) {
    query['FileUrl'] = request.fileUrl;
  }
  if (!Util.isUnset(request.formulaEnhancement)) {
    query['FormulaEnhancement'] = request.formulaEnhancement;
  }
  if (!Util.isUnset(request.llmEnhancement)) {
    query['LlmEnhancement'] = request.llmEnhancement;
  }
  if (!Util.isUnset(request.ossBucket)) {
    query['OssBucket'] = request.ossBucket;
  }
  if (!Util.isUnset(request.ossEndpoint)) {
    query['OssEndpoint'] = request.ossEndpoint;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'SubmitDocParserJob',
    version = '2022-07-11',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary 文档智能解析流式输出
 *
 * @param request SubmitDocParserJobRequest
 * @return SubmitDocParserJobResponse
 */
async function submitDocParserJob(request: SubmitDocParserJobRequest): SubmitDocParserJobResponse {
  var runtime = new Util.RuntimeOptions{};
  return submitDocParserJobWithOptions(request, runtime);
}

async function submitDocParserJobAdvance(request: SubmitDocParserJobAdvanceRequest, runtime: Util.RuntimeOptions): SubmitDocParserJobResponse {
  // Step 0: init client
  var accessKeyId = @credential.getAccessKeyId();
  var accessKeySecret = @credential.getAccessKeySecret();
  var securityToken = @credential.getSecurityToken();
  var credentialType = @credential.getType();
  var openPlatformEndpoint = @openPlatformEndpoint;
  if(Util.empty(openPlatformEndpoint)) {
    openPlatformEndpoint ='openplatform.aliyuncs.com';
  }
  if(Util.isUnset(credentialType)) {
    credentialType ='access_key';
  }
  var authConfig = new OpenApi.Config{
    accessKeyId = accessKeyId,
    accessKeySecret = accessKeySecret,
    securityToken = securityToken,
    type = credentialType,
    endpoint = openPlatformEndpoint,
    protocol = @protocol,
    regionId = @regionId,
  };
  var authClient = new OpenPlatform(authConfig);
  var authRequest = new OpenPlatform.AuthorizeFileUploadRequest{
    product = 'docmind-api',
    regionId = @regionId,
  };
  var authResponse = new OpenPlatform.AuthorizeFileUploadResponse{};
  var ossConfig = new OSS.Config{
    accessKeyId = accessKeyId,
    accessKeySecret = accessKeySecret,
    type = 'access_key',
    protocol = @protocol,
    regionId = @regionId,
  };
  var ossClient : OSS = new OSS(ossConfig);

  var fileObj = new FileForm.FileField{};
  var ossHeader = new OSS.PostObjectRequest.header{};
  var uploadRequest = new OSS.PostObjectRequest{};
  var ossRuntime = new OSSUtil.RuntimeOptions{};
  OpenApiUtil.convert(runtime, ossRuntime);
  var submitDocParserJobReq = new SubmitDocParserJobRequest{};
  OpenApiUtil.convert(request, submitDocParserJobReq);

  if(!Util.isUnset(request.fileUrlObject)) {
    authResponse = authClient.authorizeFileUploadWithOptions(authRequest, runtime);
    ossConfig.accessKeyId = authResponse.body.accessKeyId;
    ossConfig.endpoint = OpenApiUtil.getEndpoint(authResponse.body.endpoint, authResponse.body.useAccelerate, @endpointType);
    ossClient = new OSS(ossConfig);

    fileObj = new FileForm.FileField{
      filename = authResponse.body.objectKey,
      content = request.fileUrlObject,
      contentType = '',
    };
    ossHeader = new OSS.PostObjectRequest.header{
      accessKeyId = authResponse.body.accessKeyId,
      policy = authResponse.body.encodedPolicy,
      signature = authResponse.body.signature,
      key = authResponse.body.objectKey,
      file = fileObj,
      successActionStatus = '201',
    };
    uploadRequest = new OSS.PostObjectRequest{
      bucketName = authResponse.body.bucket,
      header = ossHeader,
    };
    ossClient.postObject(uploadRequest, ossRuntime);
    submitDocParserJobReq.fileUrl = `http://${authResponse.body.bucket}.${authResponse.body.endpoint}/${authResponse.body.objectKey}`;
  }
  var submitDocParserJobResp = submitDocParserJobWithOptions(submitDocParserJobReq, runtime);
  return submitDocParserJobResp;
}

model SubmitDocStructureJobRequest {
  allowPptFormat?: boolean(name='AllowPptFormat'),
  fileName?: string(name='FileName', example='docStructure.pdf'),
  fileNameExtension?: string(name='FileNameExtension', example='pdf'),
  fileUrl?: string(name='FileUrl', example='https://gw.alipayobjects.com/os/basement_prod/598b9edf-5287-4065-9e36-464305c60698.pdf'),
  formulaEnhancement?: boolean(name='FormulaEnhancement'),
  ossBucket?: string(name='OssBucket'),
  ossEndpoint?: string(name='OssEndpoint'),
  structureType?: string(name='StructureType'),
}

model SubmitDocStructureJobAdvanceRequest {
  allowPptFormat?: boolean(name='AllowPptFormat'),
  fileName?: string(name='FileName', example='docStructure.pdf'),
  fileNameExtension?: string(name='FileNameExtension', example='pdf'),
  fileUrlObject?: readable(name='FileUrl', example='https://gw.alipayobjects.com/os/basement_prod/598b9edf-5287-4065-9e36-464305c60698.pdf'),
  formulaEnhancement?: boolean(name='FormulaEnhancement'),
  ossBucket?: string(name='OssBucket'),
  ossEndpoint?: string(name='OssEndpoint'),
  structureType?: string(name='StructureType'),
}

model SubmitDocStructureJobResponseBody = {
  code?: string(name='Code', example='noPermission'),
  data?: {
    id?: string(name='Id', example='docmind-20220816-15bc7965'),
  }(name='Data'),
  message?: string(name='Message', example='You are not authorized to perform this operation.'),
  requestId?: string(name='RequestId', example='43A29C77-405E-4CC0-BC55-EE694AD00655'),
}

model SubmitDocStructureJobResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: SubmitDocStructureJobResponseBody(name='body'),
}

/**
 * @summary 文档智能解析
 *
 * @param request SubmitDocStructureJobRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return SubmitDocStructureJobResponse
 */
async function submitDocStructureJobWithOptions(request: SubmitDocStructureJobRequest, runtime: Util.RuntimeOptions): SubmitDocStructureJobResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.allowPptFormat)) {
    query['AllowPptFormat'] = request.allowPptFormat;
  }
  if (!Util.isUnset(request.fileName)) {
    query['FileName'] = request.fileName;
  }
  if (!Util.isUnset(request.fileNameExtension)) {
    query['FileNameExtension'] = request.fileNameExtension;
  }
  if (!Util.isUnset(request.fileUrl)) {
    query['FileUrl'] = request.fileUrl;
  }
  if (!Util.isUnset(request.formulaEnhancement)) {
    query['FormulaEnhancement'] = request.formulaEnhancement;
  }
  if (!Util.isUnset(request.ossBucket)) {
    query['OssBucket'] = request.ossBucket;
  }
  if (!Util.isUnset(request.ossEndpoint)) {
    query['OssEndpoint'] = request.ossEndpoint;
  }
  if (!Util.isUnset(request.structureType)) {
    query['StructureType'] = request.structureType;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'SubmitDocStructureJob',
    version = '2022-07-11',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary 文档智能解析
 *
 * @param request SubmitDocStructureJobRequest
 * @return SubmitDocStructureJobResponse
 */
async function submitDocStructureJob(request: SubmitDocStructureJobRequest): SubmitDocStructureJobResponse {
  var runtime = new Util.RuntimeOptions{};
  return submitDocStructureJobWithOptions(request, runtime);
}

async function submitDocStructureJobAdvance(request: SubmitDocStructureJobAdvanceRequest, runtime: Util.RuntimeOptions): SubmitDocStructureJobResponse {
  // Step 0: init client
  var accessKeyId = @credential.getAccessKeyId();
  var accessKeySecret = @credential.getAccessKeySecret();
  var securityToken = @credential.getSecurityToken();
  var credentialType = @credential.getType();
  var openPlatformEndpoint = @openPlatformEndpoint;
  if(Util.empty(openPlatformEndpoint)) {
    openPlatformEndpoint ='openplatform.aliyuncs.com';
  }
  if(Util.isUnset(credentialType)) {
    credentialType ='access_key';
  }
  var authConfig = new OpenApi.Config{
    accessKeyId = accessKeyId,
    accessKeySecret = accessKeySecret,
    securityToken = securityToken,
    type = credentialType,
    endpoint = openPlatformEndpoint,
    protocol = @protocol,
    regionId = @regionId,
  };
  var authClient = new OpenPlatform(authConfig);
  var authRequest = new OpenPlatform.AuthorizeFileUploadRequest{
    product = 'docmind-api',
    regionId = @regionId,
  };
  var authResponse = new OpenPlatform.AuthorizeFileUploadResponse{};
  var ossConfig = new OSS.Config{
    accessKeyId = accessKeyId,
    accessKeySecret = accessKeySecret,
    type = 'access_key',
    protocol = @protocol,
    regionId = @regionId,
  };
  var ossClient : OSS = new OSS(ossConfig);

  var fileObj = new FileForm.FileField{};
  var ossHeader = new OSS.PostObjectRequest.header{};
  var uploadRequest = new OSS.PostObjectRequest{};
  var ossRuntime = new OSSUtil.RuntimeOptions{};
  OpenApiUtil.convert(runtime, ossRuntime);
  var submitDocStructureJobReq = new SubmitDocStructureJobRequest{};
  OpenApiUtil.convert(request, submitDocStructureJobReq);

  if(!Util.isUnset(request.fileUrlObject)) {
    authResponse = authClient.authorizeFileUploadWithOptions(authRequest, runtime);
    ossConfig.accessKeyId = authResponse.body.accessKeyId;
    ossConfig.endpoint = OpenApiUtil.getEndpoint(authResponse.body.endpoint, authResponse.body.useAccelerate, @endpointType);
    ossClient = new OSS(ossConfig);

    fileObj = new FileForm.FileField{
      filename = authResponse.body.objectKey,
      content = request.fileUrlObject,
      contentType = '',
    };
    ossHeader = new OSS.PostObjectRequest.header{
      accessKeyId = authResponse.body.accessKeyId,
      policy = authResponse.body.encodedPolicy,
      signature = authResponse.body.signature,
      key = authResponse.body.objectKey,
      file = fileObj,
      successActionStatus = '201',
    };
    uploadRequest = new OSS.PostObjectRequest{
      bucketName = authResponse.body.bucket,
      header = ossHeader,
    };
    ossClient.postObject(uploadRequest, ossRuntime);
    submitDocStructureJobReq.fileUrl = `http://${authResponse.body.bucket}.${authResponse.body.endpoint}/${authResponse.body.objectKey}`;
  }
  var submitDocStructureJobResp = submitDocStructureJobWithOptions(submitDocStructureJobReq, runtime);
  return submitDocStructureJobResp;
}

model SubmitDocumentExtractJobRequest {
  fileName?: string(name='FileName'),
  fileNameExtension?: string(name='FileNameExtension', example='pdf'),
  fileUrl?: string(name='FileUrl', example='https://gw.alipayobjects.com/os/basement_prod/598b9edf-5287-4065-9e36-464305c60698.pdf'),
  ossBucket?: string(name='OssBucket'),
  ossEndpoint?: string(name='OssEndpoint'),
}

model SubmitDocumentExtractJobAdvanceRequest {
  fileName?: string(name='FileName'),
  fileNameExtension?: string(name='FileNameExtension', example='pdf'),
  fileUrlObject?: readable(name='FileUrl', example='https://gw.alipayobjects.com/os/basement_prod/598b9edf-5287-4065-9e36-464305c60698.pdf'),
  ossBucket?: string(name='OssBucket'),
  ossEndpoint?: string(name='OssEndpoint'),
}

model SubmitDocumentExtractJobResponseBody = {
  code?: string(name='Code', example='noPermission'),
  data?: {
    id?: string(name='Id', example='docmind-20220816-15bc7965'),
  }(name='Data'),
  message?: string(name='Message', example='You are not authorized to perform this operation.'),
  requestId?: string(name='RequestId', example='43A29C77-405E-4CC0-BC55-EE694AD00655'),
}

model SubmitDocumentExtractJobResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: SubmitDocumentExtractJobResponseBody(name='body'),
}

/**
 * @summary 文档抽取
 *
 * @param request SubmitDocumentExtractJobRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return SubmitDocumentExtractJobResponse
 */
async function submitDocumentExtractJobWithOptions(request: SubmitDocumentExtractJobRequest, runtime: Util.RuntimeOptions): SubmitDocumentExtractJobResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.fileName)) {
    query['FileName'] = request.fileName;
  }
  if (!Util.isUnset(request.fileNameExtension)) {
    query['FileNameExtension'] = request.fileNameExtension;
  }
  if (!Util.isUnset(request.fileUrl)) {
    query['FileUrl'] = request.fileUrl;
  }
  if (!Util.isUnset(request.ossBucket)) {
    query['OssBucket'] = request.ossBucket;
  }
  if (!Util.isUnset(request.ossEndpoint)) {
    query['OssEndpoint'] = request.ossEndpoint;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'SubmitDocumentExtractJob',
    version = '2022-07-11',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary 文档抽取
 *
 * @param request SubmitDocumentExtractJobRequest
 * @return SubmitDocumentExtractJobResponse
 */
async function submitDocumentExtractJob(request: SubmitDocumentExtractJobRequest): SubmitDocumentExtractJobResponse {
  var runtime = new Util.RuntimeOptions{};
  return submitDocumentExtractJobWithOptions(request, runtime);
}

async function submitDocumentExtractJobAdvance(request: SubmitDocumentExtractJobAdvanceRequest, runtime: Util.RuntimeOptions): SubmitDocumentExtractJobResponse {
  // Step 0: init client
  var accessKeyId = @credential.getAccessKeyId();
  var accessKeySecret = @credential.getAccessKeySecret();
  var securityToken = @credential.getSecurityToken();
  var credentialType = @credential.getType();
  var openPlatformEndpoint = @openPlatformEndpoint;
  if(Util.empty(openPlatformEndpoint)) {
    openPlatformEndpoint ='openplatform.aliyuncs.com';
  }
  if(Util.isUnset(credentialType)) {
    credentialType ='access_key';
  }
  var authConfig = new OpenApi.Config{
    accessKeyId = accessKeyId,
    accessKeySecret = accessKeySecret,
    securityToken = securityToken,
    type = credentialType,
    endpoint = openPlatformEndpoint,
    protocol = @protocol,
    regionId = @regionId,
  };
  var authClient = new OpenPlatform(authConfig);
  var authRequest = new OpenPlatform.AuthorizeFileUploadRequest{
    product = 'docmind-api',
    regionId = @regionId,
  };
  var authResponse = new OpenPlatform.AuthorizeFileUploadResponse{};
  var ossConfig = new OSS.Config{
    accessKeyId = accessKeyId,
    accessKeySecret = accessKeySecret,
    type = 'access_key',
    protocol = @protocol,
    regionId = @regionId,
  };
  var ossClient : OSS = new OSS(ossConfig);

  var fileObj = new FileForm.FileField{};
  var ossHeader = new OSS.PostObjectRequest.header{};
  var uploadRequest = new OSS.PostObjectRequest{};
  var ossRuntime = new OSSUtil.RuntimeOptions{};
  OpenApiUtil.convert(runtime, ossRuntime);
  var submitDocumentExtractJobReq = new SubmitDocumentExtractJobRequest{};
  OpenApiUtil.convert(request, submitDocumentExtractJobReq);

  if(!Util.isUnset(request.fileUrlObject)) {
    authResponse = authClient.authorizeFileUploadWithOptions(authRequest, runtime);
    ossConfig.accessKeyId = authResponse.body.accessKeyId;
    ossConfig.endpoint = OpenApiUtil.getEndpoint(authResponse.body.endpoint, authResponse.body.useAccelerate, @endpointType);
    ossClient = new OSS(ossConfig);

    fileObj = new FileForm.FileField{
      filename = authResponse.body.objectKey,
      content = request.fileUrlObject,
      contentType = '',
    };
    ossHeader = new OSS.PostObjectRequest.header{
      accessKeyId = authResponse.body.accessKeyId,
      policy = authResponse.body.encodedPolicy,
      signature = authResponse.body.signature,
      key = authResponse.body.objectKey,
      file = fileObj,
      successActionStatus = '201',
    };
    uploadRequest = new OSS.PostObjectRequest{
      bucketName = authResponse.body.bucket,
      header = ossHeader,
    };
    ossClient.postObject(uploadRequest, ossRuntime);
    submitDocumentExtractJobReq.fileUrl = `http://${authResponse.body.bucket}.${authResponse.body.endpoint}/${authResponse.body.objectKey}`;
  }
  var submitDocumentExtractJobResp = submitDocumentExtractJobWithOptions(submitDocumentExtractJobReq, runtime);
  return submitDocumentExtractJobResp;
}

model SubmitTableUnderstandingJobRequest {
  fileName?: string(name='FileName'),
  fileNameExtension?: string(name='FileNameExtension', example='pdf'),
  fileUrl?: string(name='FileUrl', example='https://gw.alipayobjects.com/os/basement_prod/598b9edf-5287-4065-9e36-464305c60698.pdf'),
  ossBucket?: string(name='OssBucket'),
  ossEndpoint?: string(name='OssEndpoint'),
}

model SubmitTableUnderstandingJobAdvanceRequest {
  fileName?: string(name='FileName'),
  fileNameExtension?: string(name='FileNameExtension', example='pdf'),
  fileUrlObject?: readable(name='FileUrl', example='https://gw.alipayobjects.com/os/basement_prod/598b9edf-5287-4065-9e36-464305c60698.pdf'),
  ossBucket?: string(name='OssBucket'),
  ossEndpoint?: string(name='OssEndpoint'),
}

model SubmitTableUnderstandingJobResponseBody = {
  code?: string(name='Code', example='noPermission'),
  data?: {
    id?: string(name='Id', example='docmind-20220816-15bc7965'),
  }(name='Data'),
  message?: string(name='Message', example='You are not authorized to perform this operation.'),
  requestId?: string(name='RequestId', example='43A29C77-405E-4CC0-BC55-EE694AD00655'),
}

model SubmitTableUnderstandingJobResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: SubmitTableUnderstandingJobResponseBody(name='body'),
}

/**
 * @summary 表格智能解析
 *
 * @param request SubmitTableUnderstandingJobRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return SubmitTableUnderstandingJobResponse
 */
async function submitTableUnderstandingJobWithOptions(request: SubmitTableUnderstandingJobRequest, runtime: Util.RuntimeOptions): SubmitTableUnderstandingJobResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.fileName)) {
    query['FileName'] = request.fileName;
  }
  if (!Util.isUnset(request.fileNameExtension)) {
    query['FileNameExtension'] = request.fileNameExtension;
  }
  if (!Util.isUnset(request.fileUrl)) {
    query['FileUrl'] = request.fileUrl;
  }
  if (!Util.isUnset(request.ossBucket)) {
    query['OssBucket'] = request.ossBucket;
  }
  if (!Util.isUnset(request.ossEndpoint)) {
    query['OssEndpoint'] = request.ossEndpoint;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'SubmitTableUnderstandingJob',
    version = '2022-07-11',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary 表格智能解析
 *
 * @param request SubmitTableUnderstandingJobRequest
 * @return SubmitTableUnderstandingJobResponse
 */
async function submitTableUnderstandingJob(request: SubmitTableUnderstandingJobRequest): SubmitTableUnderstandingJobResponse {
  var runtime = new Util.RuntimeOptions{};
  return submitTableUnderstandingJobWithOptions(request, runtime);
}

async function submitTableUnderstandingJobAdvance(request: SubmitTableUnderstandingJobAdvanceRequest, runtime: Util.RuntimeOptions): SubmitTableUnderstandingJobResponse {
  // Step 0: init client
  var accessKeyId = @credential.getAccessKeyId();
  var accessKeySecret = @credential.getAccessKeySecret();
  var securityToken = @credential.getSecurityToken();
  var credentialType = @credential.getType();
  var openPlatformEndpoint = @openPlatformEndpoint;
  if(Util.empty(openPlatformEndpoint)) {
    openPlatformEndpoint ='openplatform.aliyuncs.com';
  }
  if(Util.isUnset(credentialType)) {
    credentialType ='access_key';
  }
  var authConfig = new OpenApi.Config{
    accessKeyId = accessKeyId,
    accessKeySecret = accessKeySecret,
    securityToken = securityToken,
    type = credentialType,
    endpoint = openPlatformEndpoint,
    protocol = @protocol,
    regionId = @regionId,
  };
  var authClient = new OpenPlatform(authConfig);
  var authRequest = new OpenPlatform.AuthorizeFileUploadRequest{
    product = 'docmind-api',
    regionId = @regionId,
  };
  var authResponse = new OpenPlatform.AuthorizeFileUploadResponse{};
  var ossConfig = new OSS.Config{
    accessKeyId = accessKeyId,
    accessKeySecret = accessKeySecret,
    type = 'access_key',
    protocol = @protocol,
    regionId = @regionId,
  };
  var ossClient : OSS = new OSS(ossConfig);

  var fileObj = new FileForm.FileField{};
  var ossHeader = new OSS.PostObjectRequest.header{};
  var uploadRequest = new OSS.PostObjectRequest{};
  var ossRuntime = new OSSUtil.RuntimeOptions{};
  OpenApiUtil.convert(runtime, ossRuntime);
  var submitTableUnderstandingJobReq = new SubmitTableUnderstandingJobRequest{};
  OpenApiUtil.convert(request, submitTableUnderstandingJobReq);

  if(!Util.isUnset(request.fileUrlObject)) {
    authResponse = authClient.authorizeFileUploadWithOptions(authRequest, runtime);
    ossConfig.accessKeyId = authResponse.body.accessKeyId;
    ossConfig.endpoint = OpenApiUtil.getEndpoint(authResponse.body.endpoint, authResponse.body.useAccelerate, @endpointType);
    ossClient = new OSS(ossConfig);

    fileObj = new FileForm.FileField{
      filename = authResponse.body.objectKey,
      content = request.fileUrlObject,
      contentType = '',
    };
    ossHeader = new OSS.PostObjectRequest.header{
      accessKeyId = authResponse.body.accessKeyId,
      policy = authResponse.body.encodedPolicy,
      signature = authResponse.body.signature,
      key = authResponse.body.objectKey,
      file = fileObj,
      successActionStatus = '201',
    };
    uploadRequest = new OSS.PostObjectRequest{
      bucketName = authResponse.body.bucket,
      header = ossHeader,
    };
    ossClient.postObject(uploadRequest, ossRuntime);
    submitTableUnderstandingJobReq.fileUrl = `http://${authResponse.body.bucket}.${authResponse.body.endpoint}/${authResponse.body.objectKey}`;
  }
  var submitTableUnderstandingJobResp = submitTableUnderstandingJobWithOptions(submitTableUnderstandingJobReq, runtime);
  return submitTableUnderstandingJobResp;
}

